package cn.itsource.test2._04direct;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer {
    public static final String DIRECTTEST = "DIRECTTEST";
    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory factory = new ConnectionFactory();
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(DIRECTTEST, BuiltinExchangeType.DIRECT);
        channel.basicPublish(DIRECTTEST, "error1", null, "directest".getBytes());
        System.out.println("发送完成");
    }
}
